/**
 * 游戏管理器
 */
cc.Class({
    extends: cc.Component,

    properties: {
        /**
         * 玩家角色节点
         */
        playerNode: cc.Node,
        /**
         * 分数文字
         */
        scoreLabel: cc.Label,
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this._player = this.playerNode.getComponent('Player');
        this._player.game = this;
        this.setInputControl();
    },

    start () {
        this.showScore(0);
    },

    // update (dt) {},

    /**
     * 设置输入控制
     */
    setInputControl () {
        this.node.on('touchstart', this._player.jump, this._player);
    },

    /**
     * 显示分数UI
     * @param {number} score 分数
     */
    showScore (score) {
        this.scoreLabel.string = score.toString();
    },
});
